package com.acme.bankapp.domain.bank;

public class CheckingAccount extends AbstractAccount {

	private double overdraft;

	public CheckingAccount(final double amount, final double overdraft) {
		super(amount);
		this.overdraft = overdraft;
	}
	
	public CheckingAccount(final double amount){
		this (amount,0.0);
	}

	@Override
	public void withdraw(double amount) {
		if (amount <= (balance+overdraft)) {
			balance -= amount;
		} else {
			System.out.println("Error: withdraw failed");
		}
	};
	

	@Override
	public double getMaximumAmountToWithdraw() {
		return (balance+overdraft);
		
	}
}

